package org.example.flyweight;

/**
 * 享元模式的作用主要是为了节省内存,区别于缓存,缓存是为了加快访问速度
 */
public class FlyweightTest {
    public static void main(String[] args) {
        FlyweightFactory flyweightFactory = new FlyweightFactory();
        Girl girl = flyweightFactory.getGirl(1);
        Girl girl2 = flyweightFactory.getGirl(2);
        Girl girl3 = flyweightFactory.getGirl(3);
        Girl girl4 = flyweightFactory.getGirl(4);
        girl.dance(0);
        girl4.dance(0);
        girl2.dance(0);
        girl3.dance(0);
    }
}
